package com.sfac.modules.test.mapper;

import com.sfac.modules.test.pojo.Country;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface CountryMapper {

    @Select("select * from test_country where country_id = #{countryId}")
    @Results(id = "countryResults", value = {
            @Result(property = "cities",column = "country_id",javaType = List.class,many = @Many(select = "com.sfac.modules.test.mapper.CityMapper.selectCityByCountryId")),
            @Result(id = true ,property = "countryId",column = "country_id")
    })
    Country selectCountry(int countryId);



}
